{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "9e5ce907-3dd3-484c-ba24-c492a3f0fd7b",
   "metadata": {},
   "outputs": [],
   "source": [
    "内部干扰和黑盒方法\n",
    "双重加密\n",
    "中间相遇攻击\n"
   ]
  },
  {
   "attachments": {
    "582edba0-4e53-42ff-9f67-8646117e0a39.png": {
     "image/png": "iVBORw0KGgoAAAANSUhEUgAAA+8AAAGmCAYAAAANsrWoAAAgAElEQVR4nO3da5KzOLIAUHGj92W8MsPKClbG/dEtj4oCG2weAs6JqJjp+sq2eNlOMpUquq7rAgAAAJCt/9t7AAAAAMBrgncAAADInOAdAAAAMid4BwAAgMwJ3gEAACBzgncAAADInOAdAAAAMid4BwAAgMwJ3gEAACBzgncAAADInOAdAAAAMid4BwAAgMwJ3gEAACBzgncAAADInOAdAAAAMid4BwAAgMwJ3gEAACBzgncAAADInOAdAAAAMid4BwAAgMwJ3gEAACBzgncAAADInOAdAAAAMid4BwAAgMwJ3gEAACBzgncAAADInOAdAAAAMid4BwAAgMwJ3gEAACBz/+w9AAA4g7quZ/394/FYaSQAwBkVXdd1ew8CAI6qKIqvn6OqKsE8APCSsnkAmKmu61AUxSKBewj/Bu9FUczO3gMA1yHzDgAT3e/30DTNy7+pqmrSczVNM/pc8Tlk4wGASPAOABOMZdmXKHmv6/pl0O+jGgBQNg8AI+q6Dvf7/U/gXlVV6LoudF23SHb88Xg8n28oiL/f70rqAeDiZN4BYMBYpn2rj82xbLyPbQC4Jpl3AOgZy3JvGTjHbHyfDDwAXJPgHYDLGsqu9zPeVVU9y+T30C+lj53p27bdZTwAwD6UzQNAGC5Tz+0jsn+zIbfxAQDrEbwDQDhOYHyUcQIAy1I2D8Dl9QPid2u576lfRq+EHgCu4Z+9BwAAe+o3gDtCJjsuTxeD+LIsDzFuAOBzMu8AXFqaxRYAAwC5ErwDcFlp1r0syx1HMt/j8fhTPm8ZOQA4Lw3rALisdK77kT8Oz7IdAMA4mXcALimngLeu66+y5mnVg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o06Hu1JFe/a/jYY/vj7j+e6eIx73rL9X0it/0/pYpgys2GV+fs0DWTm9yOCwDnIXgH2FkMSNbIFKaBRBoUxe7rY4FQGoj1g6j0Mf2Ara7rZ0WBLtv/M7Sv4w2cWOI9VdzHW+/ftm2/qhxI136P+vukfz7Fc2lK0L73uuq531QA4ATW7YcHcG1hQrf5ob+f+vu545jTKfvda6bbNnc7czK12/wU3x6nb57r1d/Hbfz08a+O9dzjvuQ+eje+T57jm27zRzz/ATgOmXeAjcS1qF/9RGO//1T3X+ZyTra2e5PtHPs3Gfd8fXIupY+J50Ss6Oivtz5F+vglpBn3foXD1Otn76w9AEyhYR3ASvpLeX0j16Xkvt0u/tW2bWiaZvX50lVVzQpU27Z9/v/YCC6E/zWnu9/vz9/Hcv6h1xz67/R/P7nhk75e/zm6/1ZviNMR4jSRoQ71Ifxubpdu55CxfzfXHYC1FZ1vXgCrsWxU/pacp//t8e4HwFOfK33c0GPiv796vk872H97Y+nb13v3+Ll//8lY0pUj9HsAYC0y7wArErjnL6e14D8N+uLjxh5fluXbzPCnmeNPtnnu+u7p496tktAXs/BN0yzeFLK/7bLvAKxJ5h0AAAAyp2EdAAAAZE7wDgAAQHZybdi7F8E7AAAA2THD+zfBOwAAAGRO8A4AAACZE7wDAABA5gTvAAAAkDnBOwAAAGTu/wHjpjUsxaMRuQAAAABJRU5ErkJggg=="
    }
   },
   "cell_type": "markdown",
   "id": "72723ab3-1d5c-4d16-9419-6d85daba6b5c",
   "metadata": {},
   "source": [
    "双重加密。令 $F$ 为一个分组密码。拥有两倍原始长度的密钥的分组密码 $F^{\\prime}$ 可以这样定义:\n",
    "$$\n",
    "F_{k_1, k_2}^{\\prime}(x) \\stackrel{\\text { def }}{=} F_{k_2}\\left(F_{k_1}(x)\\right)\n",
    "$$\n",
    "\n",
    "这里 $k_1$ 和 $k_2$ 是相互独立的秘钥。如果 $F$ 是 DES, 那么结果㳯是一个密钥大小为 112 比特的分组 密码 $F^{\\prime}$ 。如果穷举密钥搜索是可用的对 $F^{\\prime}$ 的最佳攻击, 那么 112 比特的密钥长度就足够了, 因为需要 $2^{112}$ 时间的攻击完全是不可能的。不幸的是, 现在介绍一个对 $F^{\\prime}$ 的攻击, 这个攻击用 时约为 $2^n$, 在原始密钥 $k_1$ 和 $k_2$ 的长度为 $n$ 的悄况下 (分块长度至少是 $n$ )；这明显比期望的穷举 搜索 $2 n$ 比特大小的密钥所需时间少。这意味莧新的分组密码本质上并不比旧的好，即使它拥有两倍的长度同。\n",
    "\n",
    "这个攻击被称作 “中间相遇攻击”，下面解译其原因。假定给故手单个的输入/输出对 $(x, y)$, 这里 $y=F_{k_1, k_2}^{\\prime}(x)=F_{k_2}\\left(F_{k_1}(x)\\right)$, 敌手会通过以下方式缩小可能密钥集合的范围:\n",
    "\n",
    "(1) 设 $S:=\\phi$ 。\n",
    "\n",
    "(2) 对于每一个 $k_1 \\in\\{0,1\\}^n$, 计算 $z:=F_{k_1}(x)$, 井将 $\\left(z, k_1\\right)$ 储存在 $L$ 中。\n",
    "\n",
    "(3) 对于毎一个 $k_2 \\in\\{0,1\\}^n$, 计算 $z=F_{K_2}^{-1}(y)$, 并将 $\\left(z, k_2\\right)$ 储存在 $L^{\\prime}$ 中。\n",
    "\n",
    "(4) 根据第一个组成部分, 分别排序 $L$ 和 $L^{\\prime}$ 。\n",
    "\n",
    "(5) 如果 $z_1=z_2$, 假设 $L$ 的一个条目 $\\left(z_1, \\tilde{k_1}\\right)$ 以及 $L^{\\prime}$ 的一个条目 $\\left(z_2, \\tilde{k_2}\\right)$ 是匹配的。对于每个四配，将 $\\left(\\widetilde{k_1}, \\tilde{k_2}\\right)$ 添加到 $S$ 中。\n",
    "\n",
    "这种算法产生的集合 $S$ 的确包含那些 $y=F_{k_1, k_2}^{\\prime}(x)$ 的值 $\\left(k_1, k_2\\right)$ 。满足条件的原因是因为它 输出满足以下式子的 $\\left(k_1, k_2\\right):$\n",
    "\n",
    "$$\n",
    "F_{K_1}(x)=F_{K_2}^{-1}(y)\n",
    "$$\n",
    "\n",
    "这个式子在当且仅当 $y=F_{k_1, k_2}^{\\prime}(x)$ 时成立。这种攻击的描述如图 5.6 所示。\n",
    "![image.png](attachment:582edba0-4e53-42ff-9f67-8646117e0a39.png)\n",
    "\n",
    "如果 $n$ 也是 $F$ 的分块长度, 那么随机组合对 $\\left(k_1, k_2\\right)$ 就会被期望以约 $2^{-n}$ 的概率满足等式 (5.3), 并且 $S$ 中的元絭数目接近 $2^{2 n} / 2^n=2^n$ 。给定另外两个输入/输出对, 并尝试 $S$ 的所有 $2^n$ 个元素, 这些组合被期望以非常高的概率标识正确的 $\\left(k_1, k_2\\right)$ 。\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "951fe889-e5e0-4fcd-a46c-c6353bef4b4d",
   "metadata": {},
   "source": [
    "复杂度。目录 $L$ 和 $L^{\\prime}$ 在约 $2^n$ 时间内被产生和排序 (例如, 使用计数排序)。一旦目录被排序, 所有的匹配能在 $\\mathcal{O}\\left(|S|+|L|+\\left|L^{\\prime}\\right|\\right)=\\mathcal{O}\\left(2^n\\right)$ 时间内被找到 (见练习 5.13 )。使用额外的组合 $\\left(x^{\\prime}, y^{\\prime}\\right)$ 来确定正确的密钥要用 $\\mathcal{O}(|S|)=2^{\\prime \\prime}$ 时间。因而上述算法时间复杂度为 $\\mathcal{O}\\left(2^{n}\\right)$ 。"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f5190099-94b0-4940-8e5d-3978c37c720a",
   "metadata": {},
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
